package java8;

import java.util.HashMap;
import java.util.Map;

public class HashMapTest {

    public static void main(String[] args) {
        Map<HashMapTest, String> map = new HashMap<>();
        HashMapTest key = new HashMapTest();
        HashMapTest key2 = new HashMapTest();
        map.put(key, "1");
        map.put(key2, "2");
        map.computeIfAbsent(new HashMapTest(), k -> "999"); // 满足了 key == k || ( key != null && key.equals(k)) 才算present,不然就算absent
    }

    public int hashCode() {
        return 1;
    }

    public boolean equals(Object o) {
        return false;
    }
}
